#include<iostream>
#include<sys/eventfd.h>
#include<unistd.h>

using namespace std;


int main()
{
    int fd = eventfd(0,EFD_CLOEXEC | EFD_NONBLOCK);
    if (fd < 0)
    {
        perror("eventfd failed!!");
        return -1;
    }

    uint64_t v = 1;
    write(fd, &v, sizeof v);
    write(fd, &v, sizeof v);

    uint64_t buf;
    read(fd, &buf, sizeof buf);

    cout << buf << endl;
    return 0;
}